import request from '@/utils/request'

// productLists
export function productLists(query) {
    return request({
      url: '/api/jh/product/list',
      method: 'get',
      params: query
    })
  }

//配方经理查询
export function listApprovalManager(query) {
  return request({
    url: '/api/jh/product/listApprovalManager',
    method: 'get',
    params: query
  })
}



// listApproval
export function listApproval(query) {
  return request({
    url: '/api/jh/product/listApproval',
    method: 'get',
    params: query
  })
}

// reportLists
export function reportLists(query) {
    return request({
      url: '/api/jh/product/report/list',
      method: 'get',
      params: query
    })
  }

// templatelist
export function template(query) {
    return request({
      url: '/api/report/template',
      method: 'get',
      params: query
    })
  } 

// templateInsert
export function templateInsert(data) {
    return request({
      url: '/api/jh/report/template/insert',
      method: 'post',
      data: data
    })
  }

// templateUpdate
export function templateUpdate(data) {
    return request({
      url: '/api/jh/report/template/update',
      method: 'post',
      data: data
    })
  }
  
// 查询风险物质管理列表
export function listSubstance(query) {
    return request({
      url: '/api/jh/risksubstance/list',
      method: 'get',
      params: query
    })
  } 

// Delete
export function Delete(data) {
    return request({
      url: '/api/jh/report/template/delete',
      method: 'post',
      data: data
    })
  }

// addFm
export function addFm(data) {
  return request({
    url: '/api/jh/product/fm',
    method: 'post',
    data: data
  })
}

// addFm(react)
export function addFmReact(data) {
  return request({
    url: '/api/Ts/product/fm',
    method: 'post',
    data: data
  })
}

// 合规
export function uploadAbstractReport(data,id) {
  return request({
    url: '/api/jh/product/uploadAbstractReport?productId='+id,
    method: 'post',
    data: data
  })
}
 
  // 删除文件
  export function deleteAbstractReport(id) {
    return request({
      url: '/api/jh/product/deleteAbstractReport?id=' + id,
      method: 'get'
    })
  }

// fmByBql
export function fmByBql(data) {
  return request({
    url: '/api/jh/product/fmByBql',
    method: 'post',
    data: data
  })
}

// uploadRemark
export function uploadRemark(data) {
  return request({
    url: '/safety/remark/uploadRemark',
    method: 'post',
    data: data
  })
}

// uploadRemarkUpdate
export function uploadRemarkUpdate(data) {
  return request({
    url: '/safety/remark/uploadRemarkUpdate',
    method: 'post',
    data: data
  })
}
 
  // 删除产品附录
export function delRemark(id) {
  return request({
    url: '/safety/remark/' + id,
    method: 'delete'
  })
}

// editFm
export function editFm(data) {
  return request({
    url: '/api/jh/product/fm/fix',
    method: 'post',
    data: data
  })
}

// subjectTestResult
export function subjectTestResult(id) {
  return request({
    url: '/api/jh/product/subjectTestResult?id=' +id,
    method: 'get',
  })
} 

// updateSubjectTestResult
export function updateSubjectTestResult(id,data) {
  return request({
    url: '/api/jh/product/updateSubjectTestResult/' +id,
    method: 'put',
    data: data
  })
}

// addproduct
export function add(data) {
    return request({
      url: '/api/jh/product',
      method: 'post',
      data: data
    })
  }

// editProduct
export function editProduct(data) {
    return request({
      url: '/api/jh/product',
      method: 'put',
      data: data
    })
  }

// createReport
export function createReport(id,isSubject) {
  return request({
    url: '/api/jh/product/fm/createReport?id=' +id + '&isSubject='+isSubject,
    method: 'get',
  })
} 

// separatedFm
export function separatedFm(data) {
  return request({
    url: '/api/jh/product/separated/fm',
    method: 'post',
    data: data
  })
}

// 第三步提交
export function separatedFix(data) {
  return request({
    url: '/api/jh/product/separated/fm/fix',
    method: 'post',
    data: data
  })
}

// separatedCreateReport
export function separatedCreateReport(id) {
  return request({
    url: '/api/jh/product/separated/fm/createReport?id=' +id,
    method: 'get',
  })
} 


// mixedfm
export function mixedfm(data) {
  return request({
    url: '/api/jh/product/mixed/fm',
    method: 'post',
    data: data
  })
}

// 第三步mixed提交
export function mixedFix(data) {
  return request({
    url: '/api/jh/product/mixed/fm/fix',
    method: 'post',
    data: data
  })
}

// mixedCreateReport
export function mixedCreateReport(id) {
  return request({
    url: '/api/jh/product/mixed/fm/createReport?id=' +id,
    method: 'get',
  })
} 

//第五步修改
export function getRmInciResult(id) {
  return request({
    url: '/api/jh/product/getRmInciResult?id=' +id,
    method: 'get',
  })
} 

//第五步成分单独保存
export function saveSafetyRmInciResult(data) {
  return request({
    url: '/api/jh/product/saveSafetyRmInciResult',
    method: 'post',
    data: data
  })
}

//第五步批量保存，执行到第六步
export function batchSaveRmInciResult(data) {
  return request({
    url: '/api/jh/product/batchSaveRmInciResult',
    method: 'post',
    data: data
  })
}

//新第五步修改
export function updateDataResult(data) {
  return request({
    url: '/api/jh/product/updateDataResult',
    method: 'post',
    data: data
  })
}

export function getProductDetail(id) {
  return request({
    url: '/api/jh/product?id=' +id,
    method: 'get',
  })
}
//定制接口，SA详情
export function getProductForm(id) {
  return request({
    url: '/api/jh/getProductForm?procInsId='+id,
    method: 'get',
  })
}

export function refreshResult(data) {
  return request({
    url: '/api/jh/product/refreshResult',
    method: 'post',
    data: data
  })
}
